package variabilitysmelldetection.measurement.measures.spl;

import java.util.List;

import variabilitysmelldetection.measurement.measures.Measure;
import variabilitysmelldetection.measurement.models.ComponentItem;
import variabilitysmelldetection.measurement.models.MethodItem;



public class TotalNumberOfMethodRefinements extends Measure {

	public TotalNumberOfMethodRefinements() {
		super("Total Number of Method Refinements", "TNMR");
	}

	public void measure(List<ComponentItem> items){
		int numOfRefinements = 0;
		for (ComponentItem classe : items) {

			List<MethodItem> methods = classe.getMethods();

			for (MethodItem method : methods) {

				if (method.isRefinement()) {
					numOfRefinements++;
				}
			}
		}
		setValue(numOfRefinements);
	}
}
